# -*- coding: utf-8 -*-
import lunisolar

def zh_number(num):
    zh_str = ["零", "一", "二", "三", "四", "五", "六", "七", "八", "九", "十"]
    result = ""
    if num <= 10:
        result = zh_str[num]
    elif num >10 and num <20:
        result = '十'+zh_str[num %10]
    elif num == 20 or num == 30:
        result = zh_str[num/10]+'十'
    else:
        result = '廿' +zh_str[num %10]
    return result
        
def zh_year(y):
    zh_gan = ('甲', '乙', '丙', '丁', '戊', '己', '庚', '辛', '壬', '癸')
    zh_zhi = ('子', '丑', '寅', '卯', '辰', '巳', '午', '未', '申', '酉', '戌', '亥')
    return zh_gan[(y-4)%10] +zh_zhi[(y-4)%12] +'年'

def zh_month(m, l):
    result = ''
    if m ==1:
        result = '正'
    else:
        result = zh_number(m)
    if l: result = '闰' +result
    result += "月"
    return result

def zh_day(d):
    if d >10:
        result = zh_number(d)
    else:
        result = '初' +zh_number(d)
    return result +'日'

class zh_lunisolar(lunisolar.lunisolar):
    def __init__(self, lunisolar):
        self.year = zh_year(lunisolar.year)
        self.month = zh_month(lunisolar.month, lunisolar.intercalary)
        self.day = zh_day(lunisolar.day)
    def __str__(self):
        return self.year +self.month +self.day

if __name__ == '__main__':
    from datetime import date
    print zh_lunisolar(lunisolar.greg_to_luni(date.today()))
